package org.BUPT.api.controller;

import org.BUPT.admin.system.validator.UserValid;
import org.BUPT.common.vo.ResultVo;
import org.BUPT.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.security.auth.Subject;
import java.util.List;

@FeignClient("UserAndSubjectService")
public interface InterfaceController {

    @GetMapping("/getuserrole")
    public String getUserRole(@RequestParam("userId") User user);

    @GetMapping("/getsubjectteachers")
    public List<User> getSubjectTeachers(@RequestParam("subjectId") String subjectId);

    @GetMapping("/getsubjectstudents")
    public List<User> getSubjectStudents(@RequestParam("subjectId") String subjectId);

    @GetMapping("/getuserinfo")
    public User getUserInfo(@RequestParam("userId") User user);

    @GetMapping("/getusersubject")
    public List<Subject> getUserSubject(@RequestParam("userId") User user);

    /**
     * 保存修改密码
     */
    @PostMapping("/editPwd")
    public ResultVo editPwd(String original, String password, String confirm);

    /**
     * 保存修改个人信息
     */
    @PostMapping("/userInfo")
    public ResultVo userInfo(@Validated UserValid valid, User user);
}
